import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import city from './components/city/city.vue'
import home from './Home.vue'
import Detail from './components/detail/Detail.vue'


// 3. 创建路由对象
var router = new VueRouter({
  routes: [
    {path:'/',redirect:'/home'},
    {path:'/home',component:home},
    {path:'/city',component:city},
    {path:'/detail/:id',component:Detail},


  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  },
  linkActiveClass:'mui-active' //覆盖默认高亮的类：router-link-active
})

// 把路由对象暴露出去
export default router